<!-- 💥 这里是一次性加载 LayoutComponents -->
<template>
  <component :is="LayoutComponents[layout]" />
  <theme-drawer></theme-drawer>
  <message-drawer></message-drawer>
</template>

<script setup lang="ts" name="layout">
import { computed, type Component } from "vue";
import { LayoutType } from "@/stores/interface";
import { useGlobalStore } from "@/stores/modules/global";
import ThemeDrawer from "./components/Drawer/theme-drawer/index.vue";
import MessageDrawer from "./components/Drawer/message-drawer/index.vue";
/**纵向布局 */
import LayoutVertical from "./layout-vertical/index.vue";
/**经典布局 */
import LayoutClassic from "./layout-classic/index.vue";
/**横向布局 */
import LayoutTransverse from "./layout-transverse/index.vue";
/**分栏布局 */
import LayoutColumns from "./layout-columns/index.vue";

const LayoutComponents: Record<LayoutType, Component> = {
  vertical: LayoutVertical,
  classic: LayoutClassic,
  transverse: LayoutTransverse,
  columns: LayoutColumns
};

const globalStore = useGlobalStore();
const layout = computed(() => globalStore.layout);
</script>

<style scoped lang="scss">
.layout {
  min-width: 600px;
}
</style>
